#include "imageproxy.h"
#include "ImageFactory.h"
#include "QImageFactory.h"
#include "PixelImage.h"
#include "ImageLoader.h"

ImageProxy::ImageProxy():
        _type(TYPE_PIXEL),
        _path(0),
        _pos(new Pos2d()),
        _image(0)
{
}

ImageProxy::~ImageProxy(){
    delete _pos;
}

void ImageProxy::loadImage(){
    switch(_type){
    case TYPE_VECTOR:
        break;
    case TYPE_PIXEL:
        ImageFactory * factory = (ImageFactory *)Singleton::getInstance(QImageFactory::getClassName());
        ImageLoader * loader = factory->createImageLoader();
        PixelImage * pixelImage = factory->createPixelImage();
        loader->loadImage(_path);
        loader->bindImage(pixelImage);
        _image = pixelImage;
        break;
    }
}
